﻿@model IEnumerable<Sitecore.Models.Book>
@using Sitecore.Helpers
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>
    Index</h2>
<table style="width: 90%;">
    <tr>
        <td>
            <div>
                @Html.PageNavigation("List", (int)Html.ViewData["pageNumber"], (int)Html.ViewData["itemsCount"], (int)Html.ViewData["pageSize"])
            </div>
        </td>
        <td>
            <div style="text-align: right;">@Html.ActionLink("Sort by book", "List", new { SortByBookTitle = true })&nbsp
                @Html.ActionLink("Sort by author", "List", new { SortByBookTitle = false })</div>
        </td>
    </tr>
    </table>
    <table style="width: 90%;">
        <tr>
            <th>
                Title
            </th>
            <th>
                Year
            </th>
            <th>
                Authors
            </th>
            <th>
                ID
            </th>
            <th>
            </th>
        </tr>
        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.Title)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Year)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Authors)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.ID)
                </td>
                <td>
                    @Html.ActionLink("Details", "Details", new { id = item.ID })
                </td>
            </tr>
    
        }
    </table>
    <div>
        @Html.PageNavigation("List", (int)Html.ViewData["pageNumber"], (int)Html.ViewData["itemsCount"], (int)Html.ViewData["pageSize"])
    </div>
